package com.cjm.one.payment.client;

import com.alipay.api.AlipayApiException;
import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.payment.entity.AliPay;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.Map;

@FeignClient(value = ServerConstants.SERVER_ONE_PAYMENT)
public interface PaymentInfoClient {

    @PostMapping("/admin/pay/alipay/return")
    Result<Boolean> returnPay(@RequestBody AliPay aliPay) throws AlipayApiException;
    /**
     * @description: 支付宝支付接口
     * @author: cjm
     * @date: 2025/3/31 22:52
     * @param: [orderNo, httpResponse]
     * @return: void
     **/
    @GetMapping("/app/pay/alipay/pay")
    Result<String> pay(@RequestParam("orderNo") String orderNo) throws IOException;

    /**
     * @description: 支付宝支付异步通知接口
     * @author: cjm
     * @date: 2025/3/31 22:53
     * @param: [request]
     * @return: java.lang.String
     **/
    @PostMapping("/app/pay/alipay/notify")  // 注意这里必须是POST接口
    Result<String> payNotify(@RequestBody Map<String, String> params) throws Exception;

    @RequestMapping("/app/pay/balance/pay")
    @Operation(summary = "余额支付")
    Result<Boolean> balancePay(@RequestParam("orderNo") String orderNo);

}
